<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
   <%@ include file="/common/CimsCommon.jsp" %>
   <title>新增合作机构交易流水表</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="<%=basePath%>/css/cims/cmmBase.css">
	<script type="text/javascript" src="<%=basePath%>/js/cims/creditManage/contractMassage.js"></script>
	<script type="text/javascript" src="${basePath}/js/cims/publicJs/modelManage.js"></script>
	<script type="text/javascript">
		function saveCreditDeal(){
			var valueCooperorgCode = $('#dtocooperorgCode').val();
			var valueContractCode = $('#dtocontractCode').val();
			var valueQuotaSum = $('#dtoquotaSum').val();
			var creditPackageName = $('#creditPackageWrite').val();
			var dealCode = $('#dealCode').val();
			var id = $('#idValue').val();
			var sumCreditorValue = $('#sumCreditorValue').val();
			var detialNumber = $('#detialNumber').val();
			var creditorAffirmRule = $('#creditorAffirmRule').val();
			var dtoagreementCode = $('#dtoagreementCode').val();
			if(null==creditorAffirmRule||""==creditorAffirmRule){
				alert("请选择交易类型！");
				return;
			}
			if(null==valueCooperorgCode||""==valueCooperorgCode){
				alert("请选择合约！");
				return;
			}
			
			/* if(null==dealCode||""==dealCode){
				alert("请选择债权！");
				return;
			} */
			
			if(confirm("确认保存！")){
				var dataUrl =contextRootPath + "/cooperorgDeal/saveCooperorgDeal";
				$.ajax({
					url: dataUrl,
					type: 'post',
					dataType: 'json',
					data:{"cooperorgCode":valueCooperorgCode,
						  "contractCode":valueContractCode,
						  "planSellSum":valueQuotaSum,
						  "creditPackageName":creditPackageName,
						  "dealCode":dealCode,
						  "dealCodes":"${dealCodes}",
						  "id":id,
						  "sumCreditorValue":sumCreditorValue,
						  "detialNumber":detialNumber,
						  "dealType":cimsConstant.DEAL_TYPE_LOAN_MONTH_BACK,
						  "agreementCode":dtoagreementCode},
					error: function(result) {
						alert("请查看返回数据是否正确：" + result);
					},
					success: function(results) {
						alert("二次购买成功");
						parent.tabs.close();
					}
				});
			}
		}
		$(document).ready(function(){
			var value = $('#dtocooperorgCode').val();
			$('#spanCode').empty();
			if(value==""|| null ==value){
// 				toAddContract();
				$("#creditRestrainTitle").hide();
				$("#creditRestrainTitleValue").hide();
				$("#creditOperation").hide();
				$("#creditPackageColumn").hide();
				$("#creditDetailOperation").hide();
				$("#creditDetailTable").hide();
				$("#creditPackageWrite").hide();
			}else{
				$("#creditDetailTable").hide();
				
				searchCreditPackage();
			}
			
			
	   		
		});
	</script>
	
</head>
  
<body style="background-color:#FFFFFF;">
	<%@include file="../../creditDeal/common/cooperorgDeal.jsp" %>
</body>

<script type="text/javascript">
   $(document).ready(function(){
   		checkedInit();
	});
	
	
	
</script>
  
</html>
